<?php

/**
 * Celebrityvote filter form base class.
 *
 * @package    iEasy
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseCelebrityvoteFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'create_time'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'update_time'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'celebrity_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Celebrity'), 'add_empty' => true)),
      'order_i'      => new sfWidgetFormFilterInput(),
      'vote_i'       => new sfWidgetFormFilterInput(),
      'vote_mask_i'  => new sfWidgetFormFilterInput(),
      'theme'        => new sfWidgetFormChoice(array('choices' => array('' => '', '男偶像投票' => '男偶像投票', '女偶像投票' => '女偶像投票', '组合投票' => '组合投票'))),
    ));

    $this->setValidators(array(
      'create_time'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'update_time'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'celebrity_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Celebrity'), 'column' => 'celebrity_id')),
      'order_i'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'vote_i'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'vote_mask_i'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'theme'        => new sfValidatorChoice(array('required' => false, 'choices' => array('男偶像投票' => '男偶像投票', '女偶像投票' => '女偶像投票', '组合投票' => '组合投票'))),
    ));

    $this->widgetSchema->setNameFormat('celebrityvote_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Celebrityvote';
  }

  public function getFields()
  {
    return array(
      'id'           => 'Number',
      'create_time'  => 'Date',
      'update_time'  => 'Date',
      'celebrity_id' => 'ForeignKey',
      'order_i'      => 'Number',
      'vote_i'       => 'Number',
      'vote_mask_i'  => 'Number',
      'theme'        => 'Enum',
    );
  }
}
